package me.tgl.demo1.controller;

/**
 * Created by Administrator on 2017/7/11.
 */

import me.tgl.demo1.exception.MyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * hello world
 */
@Controller
public class HelloController {

    private static final Logger logger = LoggerFactory.getLogger(HelloController.class);

    @RequestMapping("/hello")
    public String index(ModelMap map) {
        logger.info("HelloController.hello start。。。");
        map.addAttribute("host", "http://tgl.me");
        return "index";
    }

    @RequestMapping("hello2")
    public String index2(ModelMap map) throws Exception {
        map.addAttribute("host", "http://tgl.me");
        throw new Exception("错误");
//        return "index";
    }

    @RequestMapping("hello3")
    public String index3(ModelMap map) throws Exception {
        map.addAttribute("host", "http://tgl.me");
        throw new MyException("SB错误");
    }
}
